#!/bin/bash

if [ "$1" = "" ]; then
   echo "Convert Slackware package to Slax Bundle"
   echo "Usage: $0 package.txz"
   exit
fi

TMPDIR=/tmp/txz2sb$$
rm -Rf $TMPDIR

while [ "$1" != "" ]; do

   if [ -r "$1" ]; then
      installpkg -root $TMPDIR "$1"
      dir2sb $TMPDIR "$(echo "$1" | sed -r "s/[.]t[gx]z\$/.sb/")"
      rm -Rf $TMPDIR
   fi
   shift
done